/* ISAAC - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */

public class ISAAC {
	public static byte[][][] tileOrientation;
	public static JString aClass3_1082;
	public int lastResult;
	public static int anInt1084;
	public static JString aClass3_1085;
	public static JString aClass3_1086;
	public static int anInt1087;
	public int counter;
	public static boolean aBoolean1089;
	public static JString aClass3_1090 = Class39_Sub5_Sub9.createJString(111, "backhmid2");
	public static int anInt1091;
	public static JString aClass3_1092;
	public int currentIndex;
	public static JString aClass3_1094;
	public static int anInt1095;
	public static Class39_Sub5_Sub10_Sub3 aClass39_Sub5_Sub10_Sub3_1096;
	public static JString aClass3_1097 = Class39_Sub5_Sub9.createJString(113, "wishes to duel with you)3");
	public static JString aClass3_1098;
	public static JString aClass3_1099;
	public static boolean aBoolean1100;
	public int accumulator;
	public int[] memory;
	public static JString aClass3_1103;
	public static Stream[] aClass39_Sub6Array1104;
	public int[] results = new int[256];

	public static void method1038(int i, int i_0_, int i_1_, int i_2_, RSInterface[] class39_sub5_sub17s, int i_3_, int i_4_, int i_5_, int i_6_, int i_7_) {
		for (int i_8_ = 0; i_8_ < class39_sub5_sub17s.length; i_8_++) {
			RSInterface class39_sub5_sub17 = class39_sub5_sub17s[i_8_];
			if (class39_sub5_sub17 != null && (class39_sub5_sub17.drawType == 0 || class39_sub5_sub17.aBoolean2047) && class39_sub5_sub17 != null && i == class39_sub5_sub17.anInt2050 && !class39_sub5_sub17.method754(117, Class19.aBoolean361)) {
				int i_9_ = i_0_ + (class39_sub5_sub17.mainX - i_5_);
				int i_10_ = -i_2_ + class39_sub5_sub17.mainY + i_7_;
				int i_11_ = i_9_ + class39_sub5_sub17.anInt2104;
				int i_12_ = i_10_ + class39_sub5_sub17.anInt2015;
				int i_13_ = i_10_ <= i_7_ ? i_7_ : i_10_;
				int i_14_ = i_4_ > i_11_ ? i_11_ : i_4_;
				int i_15_ = i_0_ < i_9_ ? i_9_ : i_0_;
				int i_16_ = i_12_ < i_3_ ? i_12_ : i_3_;
				if (class39_sub5_sub17.drawType == 0) {
					method1038(class39_sub5_sub17.anInt2084, i_15_, i_1_, class39_sub5_sub17.anInt1994, class39_sub5_sub17s, i_16_, i_14_, class39_sub5_sub17.anInt2064, i_6_, i_13_);
					if (class39_sub5_sub17.aClass39_Sub5_Sub17Array2025 != null)
						method1038(class39_sub5_sub17.anInt2084, i_15_, 1, class39_sub5_sub17.anInt1994, (class39_sub5_sub17.aClass39_Sub5_Sub17Array2025), i_16_, i_14_, class39_sub5_sub17.anInt2064, i_6_, i_13_);
				}
				if (class39_sub5_sub17.aBoolean2047) {
					boolean bool = false;
					boolean bool_17_;
					if (anInt1091 < i_15_ || Class33.anInt599 < i_13_ || i_14_ <= anInt1091 || i_16_ <= Class33.anInt599)
						bool_17_ = false;
					else
						bool_17_ = true;
					boolean bool_18_ = false;
					if (Class30.anInt541 == 1 && bool_17_)
						bool = true;
					if (Class46.mouseButtonType == 1 && Class39_Sub4.mouseX >= i_15_ && PacketParser.mouseY >= i_13_ && i_14_ > Class39_Sub4.mouseX && PacketParser.mouseY < i_16_)
						bool_18_ = true;
					if (bool_18_ && Class39_Sub5_Sub13.aClass39_Sub5_Sub17_1864 == null && (i_6_ & 0x200) != 0 && !Class39_Sub12.aBoolean1493 && (Class44.method914(class39_sub5_sub17, (byte) -128) != null)) {
						CacheArchive.anInt1303 = Class33.anInt599;
						Applet_Sub1.anInt8 = 0;
						Class39_Sub5_Sub1.anInt1684 = anInt1091;
						Class39_Sub5_Sub13.aClass39_Sub5_Sub17_1864 = class39_sub5_sub17;
						Class37.aBoolean654 = false;
					}
					if (Class39_Sub5_Sub13.aClass39_Sub5_Sub17_1864 != null || Class39_Sub12.aBoolean1493) {
						bool_17_ = false;
						bool_18_ = false;
						bool = false;
					}
					if (!class39_sub5_sub17.aBoolean2106 && bool_18_ && (i_6_ & 0x1) != 0) {
						class39_sub5_sub17.aBoolean2106 = true;
						if (class39_sub5_sub17.anObjectArray2035 != null)
							GameCharacter.method514(0, class39_sub5_sub17.anObjectArray2035, null, 125, -i_9_ + Class39_Sub4.mouseX, class39_sub5_sub17, PacketParser.mouseY - i_10_);
					}
					if (class39_sub5_sub17.aBoolean2106 && bool && (i_6_ & 0x4) != 0 && class39_sub5_sub17.anObjectArray2044 != null)
						GameCharacter.method514(0, class39_sub5_sub17.anObjectArray2044, null, -119, anInt1091 - i_9_, class39_sub5_sub17, Class33.anInt599 - i_10_);
					if (class39_sub5_sub17.aBoolean2106 && !bool && (i_6_ & 0x2) != 0) {
						class39_sub5_sub17.aBoolean2106 = false;
						if (class39_sub5_sub17.anObjectArray2085 != null)
							GameCharacter.method514(0, class39_sub5_sub17.anObjectArray2085, null, 122, anInt1091 - i_9_, class39_sub5_sub17, -i_10_ + Class33.anInt599);
					}
					if (bool && (i_6_ & 0x8) != 0 && class39_sub5_sub17.anObjectArray2080 != null)
						GameCharacter.method514(0, class39_sub5_sub17.anObjectArray2080, null, 118, anInt1091 - i_9_, class39_sub5_sub17, Class33.anInt599 - i_10_);
					if (!class39_sub5_sub17.aBoolean2042 && bool_17_ && (i_6_ & 0x10) != 0) {
						class39_sub5_sub17.aBoolean2042 = true;
						if (class39_sub5_sub17.anObjectArray2019 != null)
							GameCharacter.method514(0, class39_sub5_sub17.anObjectArray2019, null, 127, -i_9_ + anInt1091, class39_sub5_sub17, -i_10_ + Class33.anInt599);
					}
					if (class39_sub5_sub17.aBoolean2042 && bool_17_ && (i_6_ & 0x40) != 0 && class39_sub5_sub17.anObjectArray2075 != null)
						GameCharacter.method514(0, class39_sub5_sub17.anObjectArray2075, null, i_1_ - 122, anInt1091 - i_9_, class39_sub5_sub17, Class33.anInt599 - i_10_);
					if (class39_sub5_sub17.aBoolean2042 && !bool_17_ && (i_6_ & 0x20) != 0) {
						class39_sub5_sub17.aBoolean2042 = false;
						if (class39_sub5_sub17.anObjectArray2100 != null)
							GameCharacter.method514(0, class39_sub5_sub17.anObjectArray2100, null, -44, -i_9_ + anInt1091, class39_sub5_sub17, Class33.anInt599 - i_10_);
					}
					if (class39_sub5_sub17.anObjectArray2016 != null && (i_6_ & 0x80) != 0)
						GameCharacter.method514(0, (class39_sub5_sub17.anObjectArray2016), null, 106, 0, class39_sub5_sub17, 0);
					if (bool_17_ && Class62.anInt1107 != 0 && class39_sub5_sub17.anObjectArray2039 != null && (i_6_ & 0x400) != 0)
						GameCharacter.method514(0, (class39_sub5_sub17.anObjectArray2039), null, -86, 0, class39_sub5_sub17, Class62.anInt1107);
					if ((i_6_ & 0x100) != 0) {
						if (class39_sub5_sub17.anInt2012 < Class66.anInt1153 && class39_sub5_sub17.anObjectArray2101 != null)
							GameCharacter.method514(0, class39_sub5_sub17.anObjectArray2101, null, -19, 0, class39_sub5_sub17, 0);
						if ((Stream.anInt1364 > class39_sub5_sub17.anInt2012) && class39_sub5_sub17.anObjectArray2061 != null)
							GameCharacter.method514(0, class39_sub5_sub17.anObjectArray2061, null, i_1_ ^ 0x7a, 0, class39_sub5_sub17, 0);
						if (class39_sub5_sub17.anInt2012 < client.anInt1269 && class39_sub5_sub17.anObjectArray2062 != null)
							GameCharacter.method514(0, class39_sub5_sub17.anObjectArray2062, null, 123, 0, class39_sub5_sub17, 0);
						class39_sub5_sub17.anInt2012 = Class2.anInt48;
					}
				}
			}
		}
		if (i_1_ != 1)
			tileOrientation = null;
	}

	public int getNextKey(byte i) {
		if (currentIndex-- == 0) {
			generateNextKeySet(true);
			currentIndex = 255;
		}
		return 0; //results[currentIndex];
	}

	public void initializeKeySet(int i) {
		if (i < 59)
			aClass3_1097 = null;
		int i_20_;
		int i_21_;
		int i_22_;
		int i_23_;
		int i_24_;
		int i_25_;
		int i_26_;
		int i_19_ = (i_20_ = i_21_ = i_22_ = i_23_ = i_24_ = i_25_ = i_26_ = -1640531527);
		for (int i_27_ = 0; i_27_ < 4; i_27_++) {
			i_19_ ^= i_20_ << 11;
			i_22_ += i_19_;
			i_20_ += i_21_;
			i_20_ ^= i_21_ >>> 2;
			i_23_ += i_20_;
			i_21_ += i_22_;
			i_21_ ^= i_22_ << 8;
			i_22_ += i_23_;
			i_24_ += i_21_;
			i_22_ ^= i_23_ >>> 16;
			i_25_ += i_22_;
			i_23_ += i_24_;
			i_23_ ^= i_24_ << 10;
			i_26_ += i_23_;
			i_24_ += i_25_;
			i_24_ ^= i_25_ >>> 4;
			i_25_ += i_26_;
			i_19_ += i_24_;
			i_25_ ^= i_26_ << 8;
			i_26_ += i_19_;
			i_20_ += i_25_;
			i_26_ ^= i_19_ >>> 9;
			i_21_ += i_26_;
			i_19_ += i_20_;
		}
		for (int i_28_ = 0; i_28_ < 256; i_28_ += 8) {
			i_21_ += results[i_28_ + 2];
			i_23_ += results[i_28_ + 4];
			i_19_ += results[i_28_];
			i_24_ += results[i_28_ + 5];
			i_25_ += results[i_28_ + 6];
			i_20_ += results[i_28_ + 1];
			i_19_ ^= i_20_ << 11;
			i_22_ += results[i_28_ + 3];
			i_22_ += i_19_;
			i_26_ += results[i_28_ + 7];
			i_20_ += i_21_;
			i_20_ ^= i_21_ >>> 2;
			i_21_ += i_22_;
			i_23_ += i_20_;
			i_21_ ^= i_22_ << 8;
			i_22_ += i_23_;
			i_22_ ^= i_23_ >>> 16;
			i_25_ += i_22_;
			i_24_ += i_21_;
			i_23_ += i_24_;
			i_23_ ^= i_24_ << 10;
			i_24_ += i_25_;
			i_26_ += i_23_;
			i_24_ ^= i_25_ >>> 4;
			i_19_ += i_24_;
			i_25_ += i_26_;
			i_25_ ^= i_26_ << 8;
			i_20_ += i_25_;
			i_26_ += i_19_;
			i_26_ ^= i_19_ >>> 9;
			i_19_ += i_20_;
			i_21_ += i_26_;
			memory[i_28_] = i_19_;
			memory[i_28_ + 1] = i_20_;
			memory[i_28_ + 2] = i_21_;
			memory[i_28_ + 3] = i_22_;
			memory[i_28_ + 4] = i_23_;
			memory[i_28_ + 5] = i_24_;
			memory[i_28_ + 6] = i_25_;
			memory[i_28_ + 7] = i_26_;
		}
		for (int i_29_ = 0; i_29_ < 256; i_29_ += 8) {
			i_20_ += memory[i_29_ + 1];
			i_19_ += memory[i_29_];
			i_21_ += memory[i_29_ + 2];
			i_25_ += memory[i_29_ + 6];
			i_19_ ^= i_20_ << 11;
			i_22_ += memory[i_29_ + 3];
			i_26_ += memory[i_29_ + 7];
			i_22_ += i_19_;
			i_23_ += memory[i_29_ + 4];
			i_20_ += i_21_;
			i_20_ ^= i_21_ >>> 2;
			i_21_ += i_22_;
			i_21_ ^= i_22_ << 8;
			i_23_ += i_20_;
			i_24_ += memory[i_29_ + 5];
			i_22_ += i_23_;
			i_22_ ^= i_23_ >>> 16;
			i_25_ += i_22_;
			i_24_ += i_21_;
			i_23_ += i_24_;
			i_23_ ^= i_24_ << 10;
			i_24_ += i_25_;
			i_24_ ^= i_25_ >>> 4;
			i_19_ += i_24_;
			i_26_ += i_23_;
			i_25_ += i_26_;
			i_25_ ^= i_26_ << 8;
			i_26_ += i_19_;
			i_26_ ^= i_19_ >>> 9;
			i_21_ += i_26_;
			i_20_ += i_25_;
			i_19_ += i_20_;
			memory[i_29_] = i_19_;
			memory[i_29_ + 1] = i_20_;
			memory[i_29_ + 2] = i_21_;
			memory[i_29_ + 3] = i_22_;
			memory[i_29_ + 4] = i_23_;
			memory[i_29_ + 5] = i_24_;
			memory[i_29_ + 6] = i_25_;
			memory[i_29_ + 7] = i_26_;
		}
		generateNextKeySet(true);
		currentIndex = 256;
	}

	public static void method1041(boolean bool) {
		aClass3_1097 = null;
		aClass3_1090 = null;
		aClass39_Sub6Array1104 = null;
		aClass3_1086 = null;
		tileOrientation = null;
		aClass3_1092 = null;
		aClass3_1098 = null;
		aClass3_1082 = null;
		aClass3_1085 = null;
		aClass39_Sub5_Sub10_Sub3_1096 = null;
		aClass3_1103 = null;
		aClass3_1099 = null;
		aClass3_1094 = null;
	}

	public void generateNextKeySet(boolean bool) {
		if (bool == true) {
			lastResult += ++counter;
			for (int i = 0; i < 256; i++) {
				int i_30_ = memory[i];
				if ((i & 0x2) != 0) {
					if ((i & 0x1) != 0)
						accumulator ^= accumulator >>> 16;
					else
						accumulator ^= accumulator << 2;
				} else if ((i & 0x1) != 0)
					accumulator ^= accumulator >>> 6;
				else
					accumulator ^= accumulator << 13;
				accumulator += memory[i + 128 & 0xff];
				int i_31_;
				memory[i] = i_31_ = (accumulator + (memory[Class34.method342(1020, i_30_) >> 2] + lastResult));
				results[i] = lastResult = (memory[Class34.method342(i_31_, 261338) >> 8 >> 2]) + i_30_;
			}
		}
	}

	public static void method1043(int i) {
		CollisionMap.aClass57_514.method1006(i + 1540585344);
		if (i != -1540585334)
			method1044(10);
		Class18.aClass39_Sub5_Sub10_Sub4_350.method695(0, 0);
		Class53.anIntArray970 = Rasterizer.method657(Class53.anIntArray970);
	}

	public static void method1044(int i) {
		if (Class37.activeSocket != null) {
			Class37.activeSocket.killThread(-2158);
			Class37.activeSocket = null;
		}
		Class62.method1045(false);
		Class44.aClass38_836.method378();
		for (int i_32_ = 0; i_32_ < 4; i_32_++)
			Class39_Sub5_Sub12.aClass27Array1857[i_32_].method305((byte) -110);
		System.gc();
		Class41.method900((byte) -100, 10);
		OnDemandFetcher.anInt1205 = -1;
		RSSocket.anInt313 = 0;
		Class39_Sub5_Sub13.method723((byte) 115);
		Class39_Sub14.method879((byte) 40, 10);
	}

	public ISAAC(int[] is) {
		memory = new int[256];
		for (int i = 0; i < is.length; i++)
			results[i] = is[i];
		initializeKeySet(102);
	}

	static {
		aClass3_1094 = Class39_Sub5_Sub9.createJString(123, "Error loading your profile)3");
		aClass3_1085 = aClass3_1097;
		aClass3_1092 = Class39_Sub5_Sub9.createJString(108, "Wen m-Ochten Sie von der Liste entfernen?");
		aBoolean1100 = false;
		aClass3_1082 = aClass3_1094;
		aClass3_1099 = Class39_Sub5_Sub9.createJString(114, "Enter object name");
		aBoolean1089 = false;
		aClass3_1098 = aClass3_1099;
		aClass3_1103 = Class39_Sub5_Sub9.createJString(104, "backleft1");
		aClass3_1086 = Class39_Sub5_Sub9.createJString(111, "(U4");
		anInt1091 = 0;
		anInt1095 = -1;
		aClass39_Sub6Array1104 = new Stream[2048];
	}
}
